<template>
  <div class="interview-card-wrapper" v-if="config">
    <div class="interview-card">
      <div class="icon-area">
        <img :src="config.icon" :alt="config.iconAlt || '图标'" class="icon-image" />
      </div>

      <!-- 右侧内容区域 -->
      <div class="content-area">
        <h1 class="title">{{ config.title }}</h1>
        <p class="description">{{ config.description }}</p>

        <!-- 按钮组  -->
        <div class="button-group">
          <el-button 
            v-for="button in config.buttons" 
            :key="button.text"
            :type="button.type || 'default'"
            size="large" 
            round
            @click="handleButtonClick(button)"
          >
            <el-icon v-if="button.icon" style="margin-right: 3px">
              <component :is="button.icon" />
            </el-icon>
            {{ button.text }}
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue'
import { ElButton, ElIcon } from 'element-plus'

const props = defineProps({
  config: {
    type: Object,
    required: true
  }
})

const emit = defineEmits(['button-click'])

const handleButtonClick = (button) => {
  emit('button-click', button)
}
</script>

<style lang="scss" scoped>
$primary-color: #409eff;
$title-color: #303133;
$text-color: #606266;
$border-color: #dcdfe6;
$breakpoint-mobile: 768px;

// 外部容器
.interview-card-wrapper {
  display: flex;
  justify-content: center;
  box-sizing: border-box;
}

// 卡片主样式
.interview-card {
  display: flex;
  align-items: center;
  gap: 40px;
  background-color: #fff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  max-width: 1200px;
  width: 100%;
}

.icon-area {
  flex-shrink: 0; 
}

.icon-image {
  width: 120px;
  height: 120px;
  object-fit: contain; 
}

// 右侧内容区域
.content-area {
  flex: 1;
}

// 标题样式
.title {
  font-size: 2.5rem;
  font-weight: 600;
  color: $title-color;
  margin: 0 0 16px 0;
}

// 描述文字样式
.description {
  font-size: 1rem;
  color: $text-color;
  line-height: 1.7;
  margin: 0 0 30px 0;
}

// 按钮组样式
.button-group {
  display: flex;
  gap: 15px;
}

// 响应式布局
@media (max-width: $breakpoint-mobile) {
  .interview-card-wrapper {
    padding: 30px 15px;
  }
  .interview-card {
    flex-direction: column;
    text-align: center;
    padding: 30px 20px;
    gap: 25px;
  }
  
  .icon-image {
    width: 100px;
    height: 100px;
  }

  .title {
    font-size: 2rem;
  }

  .description {
    font-size: 0.9rem;
    margin-bottom: 25px;
  }

  .button-group {
    justify-content: center;
    flex-wrap: wrap;
  }
}
</style>